package javaz.jaxb.xml;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import javax.xml.bind.JAXBException;

import org.xml.sax.SAXException;

public class ImportXML {
	public static void main(String[] args) {

		String xsdLocation = System.getProperty("user.dir") + DataCountry.XSD;
		String dataLocation = System.getProperty("user.dir") + DataCountry.DATA;
		
		try {
			JaxbWrapper<DataCountry> sitemapJaxbWrapper = new JaxbWrapper<DataCountry>(new File(xsdLocation), DataCountry.class);
			InputStream is = new FileInputStream(dataLocation);
			DataCountry country = sitemapJaxbWrapper.xmlToObject(is);
			country.getName();
		} catch (FileNotFoundException | JAXBException | SAXException e) {
			e.printStackTrace();
		}
	}
}
